from lxml.html import etree

xml = """
<students>
    <hello>哈哈哈哈哈哈</hello>
    <hello>不哈</hello>
    <div>
        <hello>热热热热热1</hello>
    </div>
    <span>
        <hello>热热热热热2</hello>
    </span>
    <class a_name = "1606D">
        <student>
            <name>俄罗斯</name>
            <age>18</age>
            <sex>女</sex>
        </student>
        <student>
            <name>张三</name>
            <age>20</age>
            <sex>男</sex>
        </student>
        <student>
            <name>李四</name>
            <age>33</age>
            <sex>不知道</sex>
        </student>
    </class>
    <class a_name = "1606X">
        <student>
            <name>刘依男</name>
            <age>18</age>
            <sex>女</sex>
        </student>
        <student>
            <name>刘浩</name>
            <age>20</age>
            <sex>男</sex>
        </student>
        <student>
            <name>孙宏恩</name>
            <age>33</age>
            <sex>不知道</sex>
        </student>
    </class>
</students>
"""
# 版权声明：本文为CSDN博主「@我不认识你」的原创文章，遵循CC 4.0 BY-SA版权协议，转载请附上原文出处链接及本声明。
# 原文链接：https://blog.csdn.net/weixin_41897680/article/details/106221561

tree = etree.XML(xml)
res = tree.xpath("/students/*/hello/text()")
print(res)
